<template>
  <!-- C端客户  问题反馈 列表 -->
  <div class="app-container">
    <div class=" ">
      <el-form class="search-form-new" :model="queryParams" ref="queryForm" :inline="true"  label-width="80" v-hasPermi="['searchTenantID']">
        <el-form-item label="店铺" prop="tenantId" >
          <el-select
            v-model="queryParams.tenantId"
            placeholder="请选择店铺"
            clearable
            filterable
          >
            <el-option
              v-for="dict in tenantList"
              :key="dict.tenantId"
              :label="dict.tenantName"
              :value="dict.tenantId"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search"  @click="getList">搜索</el-button>
        </el-form-item>
      </el-form>
      <div class="table_box">
        <el-table stripe :data="tableData.records" @cell-dblclick="handleUpdate"  style="width: 100%">
          <el-table-column label="用户名称" prop="remark" />
          <el-table-column label="QQ" prop="qq" />
          <el-table-column label="手机" prop="tel" />
          <el-table-column label="反馈类型" prop="createTime" >
            <template slot-scope="scope">
                  <span>{{ typeObj[scope.row.type]}}</span>
                </template>
          </el-table-column>
          <el-table-column label="反馈时间" prop="createTime" />
          <el-table-column label="反馈内容" min-width="260" prop="content" />
          <el-table-column label="附件图片" min-width="130" prop="imgurl" >
            <template slot-scope="scope">
              <div v-if="scope.row.imgurl">
                <el-image v-for="(img,i) in scope.row.imgurl.split(',')" :key="i" :preview-src-list="scope.row.imgurl.split(',')" :src="img"  style="height:32px;margin-right:10px;margin-bottom:5px"></el-image>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!-- </el-tab-pane>
      </el-tabs> -->
    </div>
  </div>
</template>

<script>
import imageApi from "@/api/PCWebImages/fankui.js";
export default {
  name: "",
  components: { },
  data() {
    return {
      tableData: {
        records: [],
        total: 0
      },
      queryParams:{},
      loading: false,
      typeObj:{
        1:'改进建议',
        2:'问题反馈',
        3:'投诉举报',
      },
      typeOptions: [
        {
          name: '改进建议',
          id: 1
        },
        {
          name: '问题反馈',
          id: 2
        },
        {
          name: '投诉举报',
          id: 3
        },
      ],
      actived: "1",
    };
  },
  computed: {
    tenantList() {
      return this.$store.getters.tenantList
    }
  },
  created() {
    this.getList();
    // this.getTypeList();
  },
  activated() {
    this.getList();
  },
  methods: {
    // 获取列表
    getList() {
      this.tableData.records = [];
      this.loading = true;
      imageApi
        .getList(this.actived)
        .then(response => {
          //console.log("%c Line:111 🥑 response", "color:#42b983", response);
          this.$nextTick(() => {
            this.loading = false;
            this.tableData.records = JSON.parse(JSON.stringify(response.rows));
            // this.tableData.total = response.total;
          });
        })
        .catch(err => {
          this.loading = false;
        });
    },
    // 搜索
    search() {
      this.getList();
    },
    // tabs切换时触发
    tabChange() {
      this.search();
    },
    // 新增
    addACount() {
      this.$refs.addDialog.open("add");
    },
    // 双击编辑
    handleUpdate(row) {
      // 查看详情
      this.$refs.detailDialog.open(row);
    },
    // 删除记录
    delItem(row) {
      this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          imageApi.delImage(row.id).then(res => {
            this.$message({
              type: "success",
              message: "删除成功!"
            });
            this.getList()
          });
        })
        .catch(() => { });
    },

  }
};
</script>
<style lang="scss" scoped></style>
